<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="itcast" uri="http://itcast.cn/common/"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>客户列表-BootCRM</title>
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet"
	media="screen" />
<link href="<%=basePath%>css/bootstrap-datetimepicker.min.css"
	rel="stylesheet" media="screen" />
<!-- Bootstrap Core CSS -->
<link href="<%=basePath%>css/bootstrap.min.css" rel="stylesheet">

<!-- MetisMenu CSS -->
<link href="<%=basePath%>css/metisMenu.min.css" rel="stylesheet">

<!-- DataTables CSS -->
<link href="<%=basePath%>css/dataTables.bootstrap.css" rel="stylesheet">

<!-- Custom CSS -->
<link href="<%=basePath%>css/sb-admin-2.css" rel="stylesheet">

<!-- Custom Fonts -->
<link href="<%=basePath%>css/font-awesome.min.css" rel="stylesheet"
	type="text/css">
<link href="<%=basePath%>css/boot-crm.css" rel="stylesheet"
	type="text/css">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body>

	<div id="wrapper">


		<!-- Navigation -->
		<nav class="navbar navbar-default navbar-static-top" role="navigation"
			style="margin-bottom: 0">
		<div class="navbar-header">
			<button type="button" class="navbar-toggle" data-toggle="collapse"
				data-target=".navbar-collapse">
				<span class="sr-only">Toggle navigation</span> <span
					class="icon-bar"></span> <span class="icon-bar"></span> <span
					class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="<%=basePath%>index.action">工单管理系统V1.0</a>
			<div class="navbar-brand">欢迎您：${sessionScope.user_login.username}</div>
		</div>
		<!-- /.navbar-header --> <!-- /.navbar-top-links -->

		<div class="navbar-default sidebar panel-collapse collapse in"
			role="navigation">
			<div class="sidebar-nav navbar-collapse">
				<ul class="nav" id="side-menu">
					<li><a href="#WorkOrderSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;
							<i class="fa fa-th-list fa-fw"></i> 工单管理
					</a></li>
					<ul id="WorkOrderSetting" class="nav nav-list collapse secondmenu">
						<!-- <li><a href="<%=basePath%>createWorkOrder.action">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 新建工单</a></li> -->
						<li><a href="<%=basePath%>queryWorkOrder.action">&nbsp;&nbsp;<i
								class="fa fa-eye fa-fw"></i> 查询工单
						</a></li>
						<li><a href="<%=basePath%>addMissionOrder.action">&nbsp;&nbsp;<i
								class="fa fa-plus fa-fw"></i> 新建任务
						</a></li>
						<li><a href="<%=basePath%>queryMissionOrder.action">&nbsp;&nbsp;<i
								class="fa fa-folder-open fa-fw"></i> 查询任务
						</a></li>
						<li><a href="<%=basePath%>statistics.action">&nbsp;&nbsp;<i class="fa fa-line-chart fa-fw"></i> 统计数据</a></li>
					</ul>
					<li><a href="#customerSetting"
						class="sidebar-nav navbar-collapse" data-toggle="collapse">&nbsp;&nbsp;
							<i class="fa fa-user fa-fw"></i> 员工管理
					</a></li>
					<ul id="customerSetting" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>register.action">&nbsp;&nbsp;<i
								class="fa fa-plus fa-fw"></i> 创建员工
						</a></li>
						<li><a href="<%=basePath%>queryUser.action">&nbsp;&nbsp;<i
								class="fa fa-edit fa-fw"></i> 查询员工
						</a></li>
						<!-- <li><a href="#">&nbsp;&nbsp;<i class="fa fa-edit fa-fw"></i> 密码修改</a></li> -->
					</ul>
					<li><a href="#quit" class="sidebar-nav navbar-collapse"
						data-toggle="collapse">&nbsp;&nbsp;&nbsp;<i
							class="fa fa-remove fa-fw"></i> 账号登出
					</a></li>
					<ul id="quit" class="nav nav-list collapse secondmenu">
						<li><a href="<%=basePath%>quit.action">&nbsp;&nbsp;<i
								class="fa fa-remove fa-fw"></i> 退出
						</a></li>
					</ul>

				</ul>
			</div>
			<!-- /.sidebar-collapse -->
		</div>
		<!-- /.navbar-static-side --> </nav>

		<div id="page-wrapper">
			<div class="row">
				<div class="col-lg-12">
					<h1 class="page-header">员工账号注册</h1>
				</div>
				<!-- /.col-lg-12 -->
			</div>


			<div>
				<form id="registerform" class="form-horizontal" 
					style="margin-top: 5px;">
					<div class="form-group">
						<label for="id" class="col-sm-2 control-label">工号</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" id="uid" name="uid"
								placeholder="请输入员工ID" />
						</div>
					</div>
					<div class="form-group">
						<label for="username" class="col-sm-2 control-label">用户名</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" id="username"
								name="username" placeholder="请输入用户名" />
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="col-sm-2 control-label">密码</label>
						<div class="col-sm-8">
							<input type="text" class="form-control" id="password"
								name="password" placeholder="请输入密码" />
						</div>
					</div>
					<div class="form-group">
						<label for="role" class="col-sm-2 control-label">权限</label>
						<div class="col-sm-8">
							<select class="form-control" id="role" name="role">
								<option value="employee">普通员工</option>
								<option value="manager">管理员</option>
							</select>
						</div>
					</div>
					<div class="form-group" align="center">
						<div class="col-sm-12">
							<button type="button" class="btn btn-primary "
								onclick="register()">注册</button>
							<button type="button" class="btn btn-danger " onclick="toIndex()">取消</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>


	<!-- jQuery -->
	<script src="<%=basePath%>js/jquery.min.js"></script>

	<!-- Bootstrap Core JavaScript -->
	<script src="<%=basePath%>js/bootstrap.min.js"></script>

	<!-- Metis Menu Plugin JavaScript -->
	<script src="<%=basePath%>js/metisMenu.min.js"></script>

	<!-- DataTables JavaScript -->
	<script src="<%=basePath%>js/jquery.dataTables.min.js"></script>
	<script src="<%=basePath%>js/dataTables.bootstrap.min.js"></script>

	<!-- Custom Theme JavaScript -->
	<script src="<%=basePath%>js/sb-admin-2.js"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/jquery-1.8.3.min.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.zh-CN.js"
		charset="UTF-8"></script>
	<script type="text/javascript"
		src="<%=basePath%>js/locales/bootstrap-datetimepicker.fr.js"
		charset="UTF-8"></script>
	<script type="text/javascript">
	function toIndex(){
		location.href="<%=basePath%>index.action";
		}
	function register(){
		var uid = $("#uid").val();
		var username = $("#username").val();
		var password = $("#password").val();
		if(username!=null && password!=null){
			
		$.ajax({
			type:"post",
			url:"<%=basePath%>registerPage.action",
			/* data:{"grammage":grammage,"gname":gname,"pname":pname,"specification":specification,
				"address":address,"m_count":m_count}, */
			data:$('#registerform').serialize(),
			success:function(data) {
				if(data.trim()=="ok")   
				{  
					if(confirm(" 注册成功，是否继续")){
						location.href="<%=basePath%>register.action";
							}
						} else {
							alert("注册失败 ");
						}
					},
					error : function() {
						alert(" 注册失败 ");
					}
				});
			}
			else{
				alert("用户名和密码不能为空 ");
			}
		}
	</script>

</body>

</html>
